package info.lumanman.switchdatabase.util;

import org.springframework.stereotype.Component;

@Component
public class DataSourceTypeManager {

	private static final ThreadLocal<DataSources> dsTypes = new ThreadLocal<DataSources>() {

		@Override
		protected DataSources initialValue() {
			return DataSources.master;
		}
	};

	public static DataSources get() {
		return dsTypes.get();
	}

	public static void set(DataSources dataSourceType) {
		dsTypes.set(dataSourceType);
	}

	public static void reset() {
		dsTypes.set(DataSources.master);
	}

}
